﻿using System;
using System.Collections.Generic;
using CrystalDecisions.CrystalReports.Engine;
using ATSDAL;
using ATSModel;

public partial class Calibration_CalibrationDetails_intermodulation : System.Web.UI.Page
{
    private ReportDocument doc = new ReportDocument();

    private void Page_Unload(object sender, EventArgs e)
    {
        doc.Dispose();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Unload += new EventHandler(Page_Unload);
    }

    public IList<TCalIntermodulationItem> GetIntermodulationData()
    {
        IList<TCalIntermodulationItem> testItems = new List<TCalIntermodulationItem>();
        TCalIntermodulation testItem = new TCalIntermodulation();

        DateTime dt1 = (DateTime)Session["startTime"];
        DateTime dt2 = (DateTime)Session["stopTime"];
        string Id = (string)Session["InID"];

        testItems = testItem.GetIntermodulationItemByDTAndSN(dt1, dt2, Id);
        return testItems;
    }
    protected void CrystalReportViewer1_Init(object sender, EventArgs e)
    {
        ForCrystalReport();
    }
    protected void ForCrystalReport()
    {
       doc.Load(Server.MapPath("intermodulation.rpt"));

            TextObject txtTitle = (TextObject)doc.ReportDefinition.ReportObjects["Text1"];
            txtTitle.Text = (string)Session["item"] + "测试仪器/负载校验记录表";

            IList<TCalIntermodulationItem> list = GetIntermodulationData();
            doc.SetDataSource(list);
            this.CrystalReportViewer1.ReportSource = doc;

       
    }
}
